/***********************************************************************
 * Module:  AnalitikaMagacinskeKartice.java
 * Author:  Igor Spremo, Milan Stojkov
 * Purpose: Defines the Class AnalitikaMagacinskeKartice
 ***********************************************************************/

package model.entity;

import java.io.Serializable;
import java.sql.Date;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

/**
 * 
 * @author Igor Spremo, Milan Stojkov
 *
 */

@SuppressWarnings("serial")
public class AnalitikaMagacinskeKartice implements Serializable {
	
	protected Integer id;
	protected Date datum;
	protected String smer;
	protected int kolicina;
	protected double cena;
	protected double vrednost;
	protected int redniBroj;
	protected int verzija;

	protected Collection<Otpremnica> otpremnice;

	public Collection<Otpremnica> getOtpremnice() {
		if (otpremnice == null)
			otpremnice = new HashSet<Otpremnica>();
		return otpremnice;
	}

	public Iterator<Otpremnica> getIteratorOtpremnica() {
		if (otpremnice == null)
			otpremnice = new HashSet<Otpremnica>();
		return otpremnice.iterator();
	}

	public void setOtpremnice(Collection<Otpremnica> newOtpremnice) {
		removeAllOtpremnice();
		for (Iterator<Otpremnica> iter = newOtpremnice.iterator(); iter.hasNext();)
			addOtpremnica((Otpremnica) iter.next());
	}

	public void addOtpremnica(Otpremnica newOtpremnica) {
		if (newOtpremnica == null)
			return;
		if (this.otpremnice == null)
			this.otpremnice = new HashSet<Otpremnica>();
		if (!this.otpremnice.contains(newOtpremnica))
			this.otpremnice.add(newOtpremnica);
	}

	public void removeOtpremnica(Otpremnica oldOtpremnica) {
		if (oldOtpremnica == null)
			return;
		if (this.otpremnice != null)
			if (this.otpremnice.contains(oldOtpremnica))
				this.otpremnice.remove(oldOtpremnica);
	}

	public void removeAllOtpremnice() {
		if (otpremnice != null)
			otpremnice.clear();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDatum() {
		return datum;
	}

	public void setDatum(Date datum) {
		this.datum = datum;
	}

	public String getSmer() {
		return smer;
	}

	public void setSmer(String smer) {
		this.smer = smer;
	}

	public int getKolicina() {
		return kolicina;
	}

	public void setKolicina(int kolicina) {
		this.kolicina = kolicina;
	}

	public double getCena() {
		return cena;
	}

	public void setCena(double cena) {
		this.cena = cena;
	}

	public double getVrednost() {
		return vrednost;
	}

	public void setVrednost(double vrednost) {
		this.vrednost = vrednost;
	}

	public int getRedniBroj() {
		return redniBroj;
	}

	public void setRedniBroj(int redniBroj) {
		this.redniBroj = redniBroj;
	}

	public int getVerzija() {
		return verzija;
	}

	public void setVerzija(int verzija) {
		this.verzija = verzija;
	}

}